package com.cheng.example.atguigu.design_pattern.flyweith;

/*
 * @author 程帅
 * @createTime: 2020/10/22 13:10
 * @Created: with IntelliJ IDEA.
 */
public class Client {

    public static void main(String[] args) {

        //创建一个工厂
        WebSiteFactory factory = new WebSiteFactory();
        //客户要一个以新闻形式发布的网站
        WebSite webSite1 = factory.getWebSiteCategory("新闻");
        webSite1.use(new User("张三"));
        System.out.println("网站数量："+factory.getWebSiteCount());

        //客户要一个以博客形式发布的网站
        WebSite webSite2 = factory.getWebSiteCategory("博客");
        webSite1.use(new User("李四"));
        factory.getWebSiteCount();
        System.out.println("网站数量："+factory.getWebSiteCount());


        //客户要一个以微信形式发布的网站
        WebSite webSite3 = factory.getWebSiteCategory("微信");
        webSite1.use(new User("王五"));
        System.out.println("网站数量："+factory.getWebSiteCount());

        //客户要一个以支付宝形式发布的网站
        WebSite webSite4 = factory.getWebSiteCategory("支付宝");
        webSite1.use(new User("赵六"));
        System.out.println("网站数量："+factory.getWebSiteCount());

        //客户要一个以支付宝形式发布的网站
        WebSite webSite5 = factory.getWebSiteCategory("支付宝");
        webSite1.use(new User("马七"));
        System.out.println("网站数量："+factory.getWebSiteCount());
    }
}
